﻿using UnityEngine;
using System.Collections;

public class AnimationUtil : MonoBehaviour 
{

    public IEnumerator DisableAnimationAfterTime(string paramName, float time)
    {
        yield return new WaitForSeconds(time);
        GetComponent<Animator>().SetBool(paramName, false);
    }

    public IEnumerator DisableAnimationAfterTime(string paramName, float time,Animator target)
    {
        yield return new WaitForSeconds(time);
        target.SetBool(paramName, false);
    }

    public IEnumerator EnableAnimationAfterTime(string paramName, float time)
    {
        yield return new WaitForSeconds(time);
        GetComponent<Animator>().SetBool(paramName, true);
    }

    public IEnumerator EnableAnimationAfterTime(string paramName, float time,Animator target)
    {
        yield return new WaitForSeconds(time);
        target.SetBool(paramName, true);
    }
}
